/**
 * Created by lichong on 2/13/2018.
 */
import React, { Component } from 'react';
import { Cascader } from 'antd';

const options = [{
    value: 'zhejiang',
    label: 'Zhejiang',
    children: [{
        value: 'hangzhou',
        label: 'Hangzhou',
    }],
}, {
    value: 'jiangsu',
    label: 'Jiangsu',
    children: [{
        value: 'nanjing',
        label: 'Nanjing',
    }],
}];

class CitySwitcher extends React.Component {
    state = {
        text: '',
    };

    onChange = (value, selectedOptions) => {
        this.setState({
            text: selectedOptions.map(o => o.label).join(', '),
        });
    }
    render() {
        return (
            <span>
        {this.state.text}
                &nbsp;
                <Cascader options={options} onChange={this.onChange}>
          <a href="#">Change city</a>
        </Cascader>
      </span>
        );
    }
}
export default CitySwitcher;